<#assign title ="角色管理">
<#include "/include/layout.ftl">
<#macro css>
</#macro>
<#macro js>
</#macro>
<#macro body>
<#import "/include/page.ftl" as pages>
	<section class="content-header">
      <h1>
        ${title}
		<div class="pull-right">
			<a class="btn btn-info" href="${contextPath}/sys/role/create.html"><i class="fa fa-plus"></i> 添加</a>
			<a class="btn btn-danger" href="javascript:;" id="del" ><i class="fa fa-trash"></i> 删除</a>
		<div>
      </h1>
    </section>
	<section class="content">
	  <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title"></h3>
            </div>
            <div class="box-body table-responsive no-padding">
              <form action="${contextPath}/sys/role/delete" method="post" id="documentForm" >
	              <table class="table table-bordered table-hover">
		                <tr>
		                  <th class="text-center"><input type="checkbox" class="checkAll" /></th>
		                  <th class="text-center">序号</th>
		                  <th class="text-center">排序</th>
		                  <th class="text-center">角色名称</th>
		                  <th class="text-center">角色编号</th>
		                  <th class="text-center">状态</th>
		                  <th class="text-center">操作</th>
		                </tr>
	    			<#if list?? && list?size gt 0>
	        			<#list list as data>
	        				<tr>
	        				  <td class="text-center"><input type="checkbox" name="checkedid" value="${data.id}" /> </td>
	        				  <td class="text-center">${data_index+1}</td>
			                  <td class="text-center">${data.orderno}</td>
			                  <td class="text-center">${data.rolename}</td>
			                  <td class="text-center">${data.rolecode}</td>
			                  <td class="text-center"><#if data.status==1>启用<#else><span style="color:red">停用</span></#if></td>
			                  <td class="text-center">
			                  	<a href="${contextPath}/sys/role/create.html?id=${data.id}"><i class="fa fa-edit"></i> 修改</a>
			                  	<a href="${contextPath}/sys/role/menu_grant.html?roleid=${data.id}"><i class="fa fa-fire"></i> 授权</a>
			                  </td>
	        				</tr>
	        			</#list>
					<#else>
						<tr>
							<td class="text-center" colspan="100">暂无数据</td>
						</tr>
	    			</#if>
	              </table>
              </form>
            </div>
          </div>
        </div>
      </div>
    </section>
    <script type="text/javascript">
		
		//ajax 返回
		function showResponse(responseText, statusText) {
			var code = responseText.code;
			var msg = responseText.msg;
			if (code == "1") {
				  layer.alert(msg,{icon: 1}, function(index){
					  location.href="${contextPath}/sys/role/index.html";
				 	  layer.close(index);
				});  
			} else {
				layer.msg(msg, {icon: 2});
			}
		}	
		
		//表单验证
		function validateForm(){
		   return $("#documentForm").validate().form();
		}
	</script>
</#macro>